﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="authorityadd.aspx.cs" Inherits="Sys_authorityadd" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>权限分配</title>
    <link rel="Stylesheet" type="text/css" href="../CSS/Style.css" />	
   <script type="text/javascript" src="../js/jquery-1.4.2.min.js"></script>	
   <script type="text/javascript">
     $(document).ready(function(){ 
             //合并单元格
              var td=null;
              var trcount=0;
              $("#table1").find("tr").each(function(){
                  if($(this).children("td").length>6){
                      if(td!=null)
                          td.attr("rowspan",trcount);
                      td=$(this).children("td").eq(0);
                      trcount=1;
                  }
                  else
                      trcount++;
              }); 
              if(td!=null)
                  td.attr("rowspan",trcount);
           //更换/增加样式
           $("#table1").addClass("authtable1"); 
           $("#table1").find("td").removeClass("authbottom authright");
          $("#table1").find("td").addClass("authall");
          $("#table1").find("input").addClass(); 
       });
       function clickbycheckbox(obj){
          var len=$(obj).attr("id").length;
          if(len==6)
             $("input[id^='"+$(obj).attr("id")+"']").attr("checked",$(obj).attr("checked")); 
          else
          {
             var keyword=$(obj).attr("id").substring(0,6);
             var num=$("input[id^="+keyword+"][class='right'][checked='true']").length;
             if(num>=1)
                $("#"+keyword).attr("checked",'true');
           else if(num==0)
                $("#"+keyword).attr("checked",'false');
          }
      } 
       function check() {
      //进行必填项验证 
          if($("#RoleName").val()=="") {
            messagebox("未填写角色名称！");
             return false; 
          }
          if($("#RoleId").val()=="") {
             messagebox("未填写角色标记！");
             return false; 
          }
          var endval="";
          $("#table1").find("input[id*='cb']:checkbox:checked").each(function(){
                  endval+=$(this).attr("id").replace("1_cb","|");});
          $("#authvalues").val(endval);
          if(endval==""){
             messagebox("不允许非正整数的编号！");
             return false; 
          }
        }
     function messagebox(message){
        $("#area").show("fast",function(){
        $("#msg").text(message);}); 
        setTimeout( function() {$("#area").hide("slow");}, 6000);  
   }
  </script>	
</head>
<body style="background-color: #f0ffff;">
    <form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
       </asp:ScriptManager> 
   <center>
    <div style="margin-top:1em;">
      <div style="text-align:left";>
        <table>
            <tr>
                <td align="right">
                    角色名称：</td>
                <td>
                    <asp:TextBox ID="RoleName" runat="server" MaxLength="8"></asp:TextBox></td>
                <td align="right">角色标记：</td>
                 <td style="text-align:left;">
                     <asp:TextBox ID="RoleId" runat="server" MaxLength="2" Width="50px" onKeypress="return (/[\d.]/.test(String.fromCharCode(event.keyCode)))" style="ime-mode:Disabled"></asp:TextBox></td>
            </tr>
            <tr>
                <td align="right">
                    角色等级：</td>
                <td align="left">
                    <select id="Rating" runat="server">
                        <option value="普通">普通</option>
                        <option value="中级">中级</option>
                    </select>
                </td>
                <td align="right">
                    状态：</td>
                 <td align="left">
                     <select id="RoleState" runat="server">
                         <option value="1">启用</option>
                         <option value="0">禁用</option> 
                     </select>
                 </td>
            </tr>
            <tr>
                <td colspan="4">请选择以下权限：
                </td>
            </tr>
            <tr>
                <td colspan="4">
                    <span id="MsgShow" style="background-color:Red;"></span>
                </td>
            </tr> 
        </table>
        </div> 
          <div id="area" style="background: #FFFCC9;border: 1px solid #FFD667; display:none;">
             <table cellpadding="0" cellspacing="0" style="width:100%">
             <tr><td style="width:50px;"><img id="Img1"  src="../Images/Warning.png" alt="提示" /></td>
             <td>警告：<span id="msg" style="color:Red;"></span></td>
             </tr>
             </table>
         </div> 
        <div runat="server" id="auth"></div>
    </div>
  <br />
       <asp:UpdatePanel ID="UpdatePanel1" runat="server">
           <ContentTemplate>
  <input type="submit" class="btn-dy-blue" value="提交"  
    onserverclick="Submit_Authority" onclick="return check();" id="SubmitAuth" runat="server" />
           </ContentTemplate>
       </asp:UpdatePanel>
        <input id="authvalues" type="hidden" runat="server" />
     </center>  
    </form>
</body>
</html>
